@extends('layouts.app')
@section('content')
    <div class="container">
        <div class="col-md-10 offset-md-1">
            <div class="card">
                <div class="card-body">
                    <h2 class="">
                        <i class="far fa-edit"></i>提个问题
                    </h2>
                    <hr>
                    <form action="/questions" method="POST" accept-charset="UTF-8">
                        {{ csrf_field() }}
                        <div class="form-group">
                            <input class="form-control" type="text" name="title"
                                   value="{{ old('title', $question->title ) }}" placeholder="请填写标题" required
                                   dusk="question-title"/>
                        </div>
                        <div class="form-group">
                            <select name="category_id" class="form-control" required dusk="question-category">
                                <option value="" hidden disabled selected>请选择分类</option>
                                @foreach($categories as $category)
                                    <option value="{{ $category->id }}">{{ $category->name }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <textarea name="content" rows="8" class="form-control" id="editor"
                                      placeholder="请输入至少三个字符的内容" required dusk="question-category">
                                {{ old('content',$question->content) }}
                            </textarea>
                        </div>
                        <div class="well well-sm">
                            <button type="submit" class="btn btn-primary btn-sm" dusk="question-submit">
                                <i class="far fa-save" aria-hidden="true"></i>
                                保存
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
@stop
